using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DaoHelper.Religion.Entity;
using DaoHelper.Religion.Entity.Helper;

namespace DaoHelper.Religion
{
	public class RelCategoriesDao : RelCategoriesDaoBase
	{
		/// <summary>
		/// Purpose: Class constructor.
		/// </summary>
		public static RelCategoriesDao Instants()
		{
			return new RelCategoriesDao();
		}

        public DataTable GetParentAll()
        {
            string strSQL = "Select * " +
                            "From relCategories " +
                            "Where ParentId=@ParentId and IsDeleted=0 " +
                            "Order By CatType, OrderIndex";
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@ParentId", Guid.Empty);
            return ExecuteDataTable(CommandType.Text, strSQL, param);
        }

        public DataTable GetChild(Guid parentId)
        {
            string strSQL = "Select * " +
                            "From relCategories " +
                            "Where ParentId=@ParentId and IsDeleted=0 " +
                            "Order By CatType, OrderIndex";
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@ParentId", parentId);
            return ExecuteDataTable(CommandType.Text, strSQL, param);
        }
	}
}
